Get IP address of visitors using Flask for Python

61

Get IP address of visitors using Flask for Python -

from flask import request
from flask import jsonify

@app.route("/get_my_ip", methods=["GET"])
def get_my_ip():
    return jsonify({'ip': request.remote_addr}), 200

Comments

Submit
0 Comments